/**
 * 功能描述
 */

define(function (require, exports, module) {
	var Dialog = require("dialog");
	var aw = require("ajaxwrapper");
	var store =require("store");
	var activeUser = store.get("user");	
	
    module.exports = {
    		saveChargeBack: function(widget){
    			var saveListData = widget.get("editgrid").getData();
    			var list = [];
    			for(var i=0; i<saveListData.length;i++){
    				var data = {
    						pkSignUpRefund:saveListData[i].pkSignUpRefund,
    						operator: activeUser.pkUser,
    						version:saveListData[i].version,
    						refundDate:saveListData[i].refundDate,
    						refund:saveListData[i].refund
        			};
    				list.push(data);
    			}
    			aw.saveOrUpdate("api/signuprefund/saveall",aw.customParam({"list":list}),function(datas){
    				widget.hide([".J-form",".J-editgrid"]).show(".J-grid");
    				widget.get("subnav").hide(["save","cancel"]).show(["startDate","destination","servicePoint"]);
    				widget.get("grid").refresh();
    				Dialog.alert({
    					title: "提示",
    					content: "保存成功！"
    				});
    			})
    		}

    };
});
